package com.matuw.android.ui;


import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * @author Shihwan
 * @date 2023/8/21
 */
public interface QComponent extends QContext {

    @Nullable
    Bundle getArguments();

    @Nullable
    <V extends View> V findViewById(@IdRes int id);

    /**
     * 创建 View
     *
     * @param inflater           布局加载器
     * @param container          父容器
     * @param savedInstanceState 保存的数据
     */
    @Nullable
    View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState);

    /**
     * view 创建完成，只会回调一次
     *
     * @param savedInstanceState 保存的数据
     */
    void doOnCreate(@Nullable Bundle savedInstanceState);

    /**
     * 关闭当前界面
     */
    void closeComponent();
}
